'''
Created on 2010-12-23

@author: zarra
'''

from utils import ExprActionManager
from model.expr_b import expr_b,Doctor



class Auth(ExprActionManager):
    def __init__(self):
        super(Auth,self).__init__('auth')
        doctor_clear_pwd_auth = Doctor_clear_password_auth()
        self.register_action(doctor_clear_pwd_auth, 'Doctor_clear_password_auth')
        
        
        

class Doctor_clear_password_auth(object):
    def do_auth(self,loginName,password):
        query=expr_b().query(Doctor).filter(
                                            Doctor.login_name==loginName).filter(
                                            Doctor.is_del !='1').filter(
                                            Doctor.password == password)
        d=query.first()
        return [False] if d ==None else [True,d]
    
    

    
    